package lesson16;

public class Person 
{
	static String courseName = "JavaEE";
	public String name;
	String address;
	private String egn;
	private int age;
	private String password;
	//City c = new City();
	
	Person() 
	{
		name = "Ivan";
		age = 0;
	}
	
	public Person(String egn, String password)
	{
		this();
		this.egn = egn;
		this.password = password;
	}
	
	void setAge(int age)
	{
		if(age >= 0 && age <= 150)
		this.age = age;
	}
	
	int getAge(String password)
	{
		if(password.equals(this.password))
			return age;
		else
			return -1;
	}
	
	void changePassword(String oldPassword, String newPassword)
	{
		if(oldPassword.equals(this.password))
		{
			this.password = newPassword;
			System.out.println("Password changed!");
		}
		else
		{
			System.out.println("Wrong password!");
		}
	}
	
	static int getPensionAge()
	{
		return 65;
	}
	
	static int workingYearsLeft(int currentAge)
	{
		return 65 - currentAge;
	}
}
